package com.zhangbo.study.designpatternlearning.proxy;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

public class ClientRun {

    public static void main(String[] args) {
        new ClientRun().execute();
    }

    public void execute() {
        try {
            MyRemote service = (MyRemote) Naming.lookup("rmi://127.0.0.1:8080/RemoteHello");
            String execute = service.execute();
            System.out.println(execute);
        } catch (NotBoundException e) {
            throw new RuntimeException(e);
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
    }

}
